local overseer = require "overseer"

overseer.setup {
  task_list = {
    direction = "left",
    bindings = {
      ["r"] = "<cmd>OverseerQuickAction restart<cr>",
      ["s"] = "<cmd>OverseerQuickAction open hsplit<cr>",
    },
  },
}

template1 = {
  -- Template definition (see below)
  name = "action1",
  builder = function(params)
    return {
      -- cmd is the only required field
      cmd = { "action-1" },
      -- additional arguments for the cmd
      args = { "hello", "world" },
      -- the name of the task (defaults to the cmd of the task)
      name = "action-1",
      components = {
        -- 快速在task list中消失，避免干扰正常构造
        { "on_complete_dispose", timeout = 10, statuses = { "SUCCESS" } },
        "default",
      },
    }
  end,
}

overseer.register_template(template1)

vim.api.nvim_set_keymap("n", "<space>o", "[_Make]", {})
vim.keymap.set("n", "[_Make]a", "<Cmd>OverseerToggle right<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "[_Make]r", "<Cmd>OverseerRun<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "[_Make]o", "<Cmd>OverseerQuickAction restart<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "[_Make]1", "<Cmd>OverseerRun action1<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "[_Make]l", "<Cmd>OverseerLoadBundle task.bundle<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "[_Make]s", "<Cmd>OverseerSaveBundle task.bundle<CR>", { noremap = true, silent = true })
